
/** This class creates the Action Box for a Data Request in the
 * {@link DecisionFrame} whenever the suggestion chosen by User is a
 * Data Request.
 *
 * @author  Gary Morris, Northern Virginia Community College		garymorris2245@verizon.net
 *
 * Created on June 24, 2011, 3:21:57 PM
 */

public class ActionDataRequest extends javax.swing.JPanel {

    DecisionFrame papa;
    DataRequest dr;  // the Data Request in focus
    int suggNmbr;

    /** Creates new form ActionDataRequest */
    public ActionDataRequest() {
        initComponents();
    }

        /** Creates new ActionUmbrella linked to parent frame */
    public ActionDataRequest(DecisionFrame frame) {
        initComponents();
        papa = frame;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        keepActiveBtn = new javax.swing.JRadioButton();
        markCompletedBtn = new javax.swing.JRadioButton();
        doneBtn = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        chartBtn = new javax.swing.JButton();

        setBorder(javax.swing.BorderFactory.createTitledBorder("Action Box: Data Request"));

        buttonGroup1.add(keepActiveBtn);
        keepActiveBtn.setSelected(true);
        keepActiveBtn.setText("Keep This Request Active");

        buttonGroup1.add(markCompletedBtn);
        markCompletedBtn.setText("Mark This Request 'Completed'");
        markCompletedBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                markCompletedBtnActionPerformed(evt);
            }
        });

        doneBtn.setText("Done");
        doneBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                doneBtnActionPerformed(evt);
            }
        });

        jLabel1.setText("You may return to this request as often as you like. ");

        jLabel2.setText("When you have provided all the data, mark this 'completed'");

        jLabel3.setText("and hit 'Done.'");

        chartBtn.setText("Go to the Chart to Enter Data");
        chartBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chartBtnActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(keepActiveBtn)
                    .add(markCompletedBtn))
                .addContainerGap(181, Short.MAX_VALUE))
            .add(layout.createSequentialGroup()
                .add(29, 29, 29)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                        .add(chartBtn)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 75, Short.MAX_VALUE)
                        .add(doneBtn))
                    .add(jLabel3)
                    .add(jLabel2)
                    .add(jLabel1))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(keepActiveBtn)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(markCompletedBtn)
                .add(47, 47, 47)
                .add(jLabel1)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel2)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel3)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 119, Short.MAX_VALUE)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(doneBtn)
                    .add(chartBtn))
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    public void load(DataRequest dis, int nmbr) {
        dr = dis;
        suggNmbr = nmbr;
        keepActiveBtn.setSelected(true);
    }



    private void markCompletedBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_markCompletedBtnActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_markCompletedBtnActionPerformed

    private void doneBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_doneBtnActionPerformed
        if (markCompletedBtn.isSelected()) {
            papa.markProcessed(suggNmbr);
        }else {
            papa.markUnProcessed(suggNmbr);
        }
        papa.reset();
    }//GEN-LAST:event_doneBtnActionPerformed

    private void chartBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chartBtnActionPerformed
        SIL_Edit.edWin.toFront();
    }//GEN-LAST:event_chartBtnActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton chartBtn;
    private javax.swing.JButton doneBtn;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JRadioButton keepActiveBtn;
    private javax.swing.JRadioButton markCompletedBtn;
    // End of variables declaration//GEN-END:variables

}
